<!--
 * @Author: liangzhuo liangzhuo@chzu.com
 * @Date: 2022-10-30 15:04:43
 * @LastEditors: liangzhuo liangzhuo@chzu.com
 * @LastEditTime: 2022-10-30 15:19:50
 * @FilePath: \hongxinUi\src\views\integralStatistics\statisticsControl\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="main">
    <!-- 头部输入框 -->
    <el-form :model="queryParams" size="small" :inline="true">
      <el-form-item label="积分类型">
        <el-select
          v-model="value"
          clearable
          placeholder="请选择"
          @change="getList"
        >
          <el-option
            v-for="item in type"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
    </el-form>
    <!-- 表格 -->
    <el-table
      :data="tableData"
      style="width: 100%"
      :row-style="{ height: '180px' }"
    >
      <el-table-column label="姓名" prop="realName" align="center">
      </el-table-column>

      <el-table-column prop="score" label="积分" align="center">
      </el-table-column>

      <el-table-column prop="studentClass" label="班级" align="center">
      </el-table-column>

      <el-table-column prop="studentGrade" label="年级" align="center">
      </el-table-column>

      <el-table-column prop="studentId" label="学号" align="center">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { searchIntegral } from "@/api/integralStatistics/integral.js";
export default {
  data() {
    return {
      // 存放学生积分数据
      tableData: [],
      // 积分类型(输入框数字)(0 学习积分 1成绩积分 2荣誉积分)
      value: 0,
      // 积分类型
      type: [
        {
          label: "学习积分",
          value: 0,
        },
        {
          label: "成绩积分",
          value: 1,
        },
        {
          label: "荣誉积分",
          value: 2,
        },
      ],
      queryParams: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      searchIntegral(this.value).then((res) => {
        this.tableData = res.data;
      });
    },
  },
};
</script>

<style scoped>
.main {
  margin: 20px;
}
</style>